<%--
  Created by IntelliJ IDEA.
  User: ddd
  Date: 2018/4/16
  Time: 19:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑题目</title>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/admin.css">
</head>

<body>
<div style="padding: 15px;">
    <%--<form class="bs-example bs-example-form" role="form" enctype="multipart/form-data" method="post" onsubmit="return ValidForm(this)">--%>
    <form class="bs-example bs-example-form" role="form"  enctype="multipart/form-data" method="post" action="/subject/fix" onsubmit='return ValidForm()'>
        <table class="table">
            <tr>
                <td width="100" rowspan="2">题目：</td>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">汉：</small></div>
                        <div class="col-lg-10">
                            <input type="text" class="form-control" name="problem" placeholder="请输入题目" value="">
                        </div>
                    </div>
                </td>
                <td rowspan="2"><small>汉：</small><textarea rows="3" id="htmltitle" name="htmltitle" class="form-control" style="height:60px;"></textarea>
                </td>
                <td rowspan="2"><small>藏：</small><textarea rows="3" id="zhtmltitle" name="zhtmltitle" class="form-control" style="height:60px;"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">藏：</small></div>
                        <div class="col-lg-10">
                            <input type="text" class="form-control" name="zproblem" placeholder="ཁྱེད་ཀྱི་ཚད་ཁ་བྱང།"
                                   value=""></div>
                    </div>
                </td>
            </tr>

            <tr>
                <td rowspan="2">选项A：</td>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">汉：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="optiona" placeholder="请输入选项A" value="违章行为"></div>
                    </div>
                </td>
                <td rowspan="2"><small>汉：</small><textarea rows="3" id="htmla" name="htmla" class="form-control" style="height:60px;"></textarea></td>
                <td rowspan="2"><small>藏：</small><textarea rows="3" id="zhtmla" name="zhtmla" class="form-control" style="height:60px;"></textarea></td>
            </tr>
            <tr>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">藏：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="zoptiona" placeholder="ཁྱེད་ཀྱི་ཚད་བསལ་འདེམས།A" value=""></div>
                    </div>
                </td>
            </tr>

            <tr>
                <td rowspan="2">选项B：</td>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">汉：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="optionb" placeholder="请输入选项B" value="违法行为"></div>
                    </div>
                </td>
                <td rowspan="2"><small>汉：</small><textarea rows="3" id="htmlb" name="htmlb" class="form-control" style="height:60px;"></textarea></td>
                <td rowspan="2"><small>藏：</small><textarea rows="3" id="zhtmlb" name="zhtmlb" class="form-control" style="height:60px;"></textarea></td>
            </tr>
            <tr>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">藏：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="zoptionb" placeholder="ཁྱེད་ཀྱི་ཚད་བསལ་འདེམས།B" value=""></div>
                    </div>
                </td>
            </tr>

            <tr>
                <td rowspan="2">选项C：</td>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">汉：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="optionc" placeholder="请输入选项C" value="过失行为"></div>
                    </div>
                </td>
                <td rowspan="2"><small>汉：</small><textarea rows="3" id="htmlc" name="htmlc" class="form-control" style="height:60px;"></textarea></td>
                <td rowspan="2"><small>藏：</small><textarea rows="3" id="zhtmlc" name="zhtmlc" class="form-control" style="height:60px;"></textarea></td>
            </tr>
            <tr>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">藏：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="zoptionc" placeholder="ཁྱེད་ཀྱི་ཚད་བསལ་འདེམས།C" value=""></div>
                    </div>
                </td>
            </tr>

            <tr>
                <td rowspan="2">选项D：</td>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">汉：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="optiond" placeholder="请输入选项D" value=""></div>
                    </div>
                </td>
                <td rowspan="2"><small>汉：</small><textarea rows="3" id="htmld" name="htmld" class="form-control" style="height:60px;"></textarea></td>
                <td rowspan="2"><small>藏：</small><textarea rows="3" id="zhtmld" name="zhtmld" class="form-control" style="height:60px;"></textarea></td>
            </tr>
            <tr>
                <td>
                    <div class="row">
                        <div class="col-lg-2" style="margin-top: 5px"><small style="margin-left: 20px">藏：</small></div>
                        <div class="col-lg-10"><input type="text" class="form-control" name="zoptiond" placeholder="ཁྱེད་ཀྱི་ཚད་བསལ་འདེམས།D" value=""></div>
                    </div>
                </td>
            </tr>

            <tr>
                <td>类型：</td>
                <td>
                    <label><input type="radio" name="type" value="0">单选题</label>
                    <label><input type="radio" name="type" value="2">多选题</label>
                    <label><input type="radio" name="type" value="1">判断题</label>
                </td>
                <td><input type="hidden" name='id' value=''></td>
            </tr>
            <tr>
                <td>答案：</td>
                <td>
                    <input type="text" class="form-control" name="answer" placeholder="请输入答案，多选以'|'隔开，例如A|B"
                           onchange="ToUp(this)" value="">
                </td>
                <td></td>
            </tr>

            <tr>
                <td>媒体类型：</td>
                <td>
                    <button id="mtypebtn" class='btn btn-success btn-ms btn-block' onclick='ReplaceMtype(this)'>更换</button>
                </td>
            </tr>
            <tr id='Mtype'>
            </tr>

            <tr>
                <td>语音读题：</td>
                <td>
                    <button id="readmusic" class='btn btn-success btn-ms btn-block' onclick='ReplaceRead(this)'>更换</button>
                </td>
                <td>藏语语音读题：
                    <button id="zreadmusic" class='btn btn-success btn-ms btn-block' onclick='ReplaceReadz(this)' style="margin-left: 150px;margin-top: -24px;width: 300px;">更换</button>
                </td>
                <td></td>
            </tr>

            <tr>
                <td rowspan="2" style="border-top: 1px solid red">技巧描述：</td>
                <td style="border-top: 1px solid red">
                </td>
                <td rowspan="2" style="border-top: 1px solid red"><small>汉：</small><textarea id="explain" name="explain" class="form-control" style="height:60px;">
                </textarea></td>
                <td rowspan="2" style="border-top: 1px solid red"><small>藏：</small><textarea id="zexplain" name="zexplain" class="form-control" style="height:60px;">
                </textarea></td>
            </tr>
            <tr>
            </tr>

            <tr>
                <td>语音讲解：</td>
                <td>
                    <button id="yuyinJiangjie" class='btn btn-success btn-ms btn-block' onclick='ReplaceMusic(this)'>更换</button>
                </td>
                <td>
                    藏语语音讲解：<button id="zyuyinJiangjie" class='btn btn-success btn-ms btn-block' onclick='ReplaceMusicz(this)' style="margin-left: 150px;margin-top: -24px;width: 300px;">更换</button>
                </td>
                <td></td>
            </tr>

            <tr>
                <td>技巧媒体类型：</td>
                <td>
                    <button id="tmtypebtn" class='btn btn-success btn-ms btn-block' onclick='ReplaceMtypejiqiao(this)'>更换</button>
                </td>
            </tr>
            <tr id='Mtypejiqiao'>
            </tr>
        </table>
        <input type="hidden" id="mtype1" value="">
        <input type="hidden" id="yuyinDu" value="">
        <input type="hidden" id="zyuyinDu" value="">
        <input type="hidden" id="yuyinJiang" value="">
        <input type="hidden" id="zyuyinJiang" value="">
        <input type="hidden" id="tmtype1" value="">
        <button class="btn btn-primary btn-lg btn-block" type='submit'>提交保存</button>
    </form>
</div>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/jquery.form.min.js"></script>
<script src="/static/layer/layer.js"></script>
<!--副文本编辑器-->
<script charset="utf-8" src="/static/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="/static/kindeditor/lang/zh-CN.js"></script>
<script>

    function closewin() {
        var ind = parent.layer.getFrameIndex(window.name);
        parent.layer.close(ind)
    }

    $(function () {
        KindEditor.ready(function (K) {
            window.htmltitle = K.create('#htmltitle', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
//            console.info($(".dd").val());
            window.htmltitle = K.create('#zhtmltitle', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });

            window.htmltitle = K.create('#htmla', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
            window.htmltitle = K.create('#zhtmla', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });

            window.htmltitle = K.create('#htmlb', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
            window.htmltitle = K.create('#zhtmlb', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });

            window.htmltitle = K.create('#htmlc', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
            window.htmltitle = K.create('#zhtmlc', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });

            window.htmltitle = K.create('#htmld', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
            window.htmltitle = K.create('#zhtmld', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });

            window.htmltitle = K.create('#explain', {
                resizeType : 1,
                allowPreviewEmoticons : false,
                allowImageUpload : false,
                items : [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
            window.htmltitle = K.create('#zexplain', {
                resizeType : 1,
                allowPreviewEmoticons : false,
                allowImageUpload : false,
                items : [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat']
            });
        });

    });
    //转义
    function escape2Html(str) {
        if(str){
            var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'};
            return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];});
        }
        return "";

    }

    //富文本框赋值
    function htitle(content) {
        KindEditor.html("#htmltitle",content);
    }
    function zhtitle(content) {
        KindEditor.html("#zhtmltitle",content);
    }
    function ha(content) {
        KindEditor.html("#htmla",content);
    }
    function zha(content) {
        KindEditor.html("#zhtmla",content);
    }
    function hb(content) {
        KindEditor.html("#htmlb",content);
    }
    function zhb(content) {
        KindEditor.html("#zhtmlb",content);
    }
    function hc(content) {
        KindEditor.html("#htmlc",content);
    }
    function zhc(content) {
        KindEditor.html("#zhtmlc",content);
    }
    function hd(content) {
        KindEditor.html("#htmld",content);
    }
    function zhd(content) {
        KindEditor.html("#zhtmld",content);
    }
    function ex(content) {
        KindEditor.html("#explain",content);
    }
    function zex(content) {
        KindEditor.html("#zexplain",content);
    }

    //有无资源文件 进行判断
    function getmtype(content) {
        $("#mtype1").val(content);
        if ($("#mtype1").val()==2){
            $("#mtypebtn").css("background-color","red").html("添加");
        }
    }
    function getyuyinDu(content) {
        $("#yuyinDu").val(content);
        var $yuyinDu = $("#yuyinDu").val();
        if (!$yuyinDu){
            $("#readmusic").css("background-color","red").html("添加");
        }
    }
    function getzyuyinDu(content) {
        $("#zyuyinDu").val(content);
        var $zyuyinDu = $("#zyuyinDu").val();
        if (!$zyuyinDu){
            $("#zreadmusic").css("background-color","red").html("添加");
        }
    }
    function getmusicPath(content) {
        $("#yuyinJiang").val(content);
        var $yuyinJiang = $("#yuyinJiang").val();
        if (!$yuyinJiang){
            $("#yuyinJiangjie").css("background-color","red").html("添加");
        }
    }
    function getzmusicPath(content) {
        $("#zyuyinJiang").val(content);
        var $zyuyinJiang = $("#zyuyinJiang").val();
        if (!$zyuyinJiang){
            $("#zyuyinJiangjie").css("background-color","red").html("添加");
        }
    }
    function getjiqiaoMtype(content) {
        $("#tmtype1").val(content);
        if ($("#tmtype1").val()==2){
            $("#tmtypebtn").css("background-color","red").html("添加");
        }
    }

    //数据校验
    function ValidForm() {
        var problem = $('input[name=problem]').val(),
            zproblem = $('input[name=zproblem]').val(),
            answer = $('input[name=answer]').val(),
            htmltitle = $('input[name=htmltitle]').val(),
            zhtmltitle = $('input[name=zhtmltitle]').val(),
            type = $("input[name='type']:checked").val(),
            mtype = $("input[name='mtype']:checked").val(),
            HiddenMtype = $("input[name=HiddenMtype]").val(),
            mfile = $('input[name=mfile]').val();
        if (!problem) {
            $('input[name=problem]').focus();
            layer.msg('请输入题目', {icon: 2, time: 1000});
            return false;
        }
        if (!answer) {
            $('input[name=answer]').focus();
            layer.msg('请输入答案', {icon: 2, time: 1000});
            return false;
        }
        if (typeof(type) == "undefined") {
            layer.msg('请选择题目类型', {icon: 2, time: 1000});
            return false;
        }
        //closewin();
    }

    function ToUp(obj) {
        var InputVal = $(obj).val();
        if (InputVal) {
            $(obj).val(InputVal.toUpperCase());
        }
    }


    function ReplaceMtype(obj) {
        $(obj).parent().html("<label><input type='radio' name='mtype' value='2'>无</label> <label><input type='radio' name='mtype' value='0'>图片</label> <label><input type='radio' name='mtype' value='1'>视频</label>  <button class='btn btn-danger btn-ms' onclick='MtypeRemove(this)'>撤销</button>");
        $('#Mtype').html("<td>媒体上传：</td><td><input type='file' name='mfile'></td><td></td>");
    }

    function ReplaceMusic(obj) {
        $(obj).parent().html("<input type='file' name='examfile' style='display:inline;'> <button class='btn btn-danger btn-ms' onclick='MusicRemove(this)'>撤销</button>");
    }

    function MtypeRemove(obj) {
        $(obj).parent().html("<button id=\"mtypebtn\" class='btn btn-success btn-ms btn-block' onclick='ReplaceMtype(this)'>更换</button>");
        $('#Mtype').html("<td><!--<input type='hidden' value='' name='mtype'>--></td>");

        if ($("#mtype1").val()==2){
            $("#mtypebtn").css("background-color","red").html("添加");
        }
    }

    function MusicRemove(obj) {
        $(obj).parent().html("<button id='yuyinJiangjie' class='btn btn-success btn-ms btn-block' onclick='ReplaceMusic(this)'>更换</button>");
        if (!$("#yuyinJiang").val()){
            $("#yuyinJiangjie").css("background-color","red").html("添加");
        }
    }
//-------------------------------------------------------------------------------------------

    function ReplaceMtypejiqiao(obj) {
        /*$(obj).parent().html("<label><input type='radio' name='tmtype' value='2'>无</label> " +
            "<label><input type='radio' name='tmtype' value='0'>图片</label> <label><input type='radio' name='tmtype' value='1'>视频</label> " +
            " <button id='tmtypebtn' class='btn btn-danger btn-ms' onclick='MtypejiqiaoRemove(this)'>撤销</button>");
        $('#Mtypejiqiao').html("<td>技巧媒体上传：</td><td><input type='file' name='emfile'></td><td></td>");
        if ($("#tmtype1").val()==2){
            $("#tmtypebtn").css("background-color","red").html("添加");
        }*/
        $(obj).parent().html("<label><input type='radio' name='tmtype' value='2'>无</label> <label><input type='radio' name='tmtype' value='0'>图片</label> <label><input type='radio' name='tmtype' value='1'>视频</label>  <button class='btn btn-danger btn-ms' onclick='MtypejiqiaoRemove(this)'>撤销</button>");
        $('#Mtypejiqiao').html("<td>媒体上传：</td><td><input type='file' name='emfile'></td><td></td>");
    }

    function ReplaceRead(obj) {
        $(obj).parent().html("<input type='file' name='readfile' style='display:inline;'> <button  class='btn btn-danger btn-ms' onclick='ReadRemove(this)'>撤销</button>");
    }

    function ReplaceReadz(obj) {
        $(obj).parent().html("<input type='file' name='zreadfile' style='display:inline;'> <button  class='btn btn-danger btn-ms' onclick='ReadRemovez(this)'>撤销</button>");
    }

    function MtypejiqiaoRemove(obj) {
        $(obj).parent().html("<button class='btn btn-success btn-ms btn-block' onclick='ReplaceMtypejiqiao(this)'>更换</button>");
        $('#Mtypejiqiao').html("<td><!--<input type='hidden' value='' name='emfile'>--></td>");
    }

    function ReadRemove(obj) {
        $(obj).parent().html("<button id='readmusic' class='btn btn-success btn-ms btn-block' onclick='ReplaceRead(this)'>更换</button>");
        if (!$("#yuyinDu").val()){
            $("#readmusic").css("background-color","red").html("添加");
        }
    }

    function ReadRemovez(obj) {
        $(obj).parent().html("藏语语音读题：\n" +
            " <button id='zreadmusic' class='btn btn-success btn-ms btn-block' onclick='ReplaceReadz(this)' style=\"margin-left: 150px;margin-top: -24px;width: 300px;\">更换</button>");
        if (!$("#zyuyinDu").val()){
            $("#zreadmusic").css("background-color","red").html("添加");
        }
    }

    function ReplaceMusicz(obj) {
        $(obj).parent().html("<input type='file' name='zexamfile' style='display:inline;'> <button class='btn btn-danger btn-ms' onclick='MusicRemovez(this)'>撤销</button>");
    }

    function MusicRemovez(obj) {
        $(obj).parent().html("藏语语音讲解：<button id='zyuyinJiangjie' class='btn btn-success btn-ms btn-block' onclick='ReplaceMusicz(this)' style=\"margin-left: 150px;margin-top: -24px;width: 300px;\">更换</button>");
        if (!$("#zyuyinJiang").val()){
            $("#zyuyinJiangjie").css("background-color","red").html("添加");
        }
    }

    
    $(".btn-block").click(function () {
        var key = $("input[name=answer]").val();
        if (key == "A") {
            $("input[name=answer]").val(1);
        }
        if (key == "B") {
            $("input[name=answer]").val(2);
        }
        if (key == "C") {
            $("input[name=answer]").val(4);
        }
        if (key == "D") {
            $("input[name=answer]").val(8);
        }
        if (key == "A|B"||key == "B|A") {
            $("input[name=answer]").val(3);
        }
        if (key == "A|C"||key == "C|A") {
            $("input[name=answer]").val(5);
        }
        if (key == "A|D"||key == "D|A") {
            $("input[name=answer]").val(9);
        }
        if (key == "B|C"||key == "C|B") {
            $("input[name=answer]").val(6);
        }
        if (key == "B|D"||key == "D|B") {
            $("input[name=answer]").val(10);
        }
        if (key == "C|D"||key == "D|C") {
            $("input[name=answer]").val(12);
        }
        if (key == "A|B|C"||key == "A|C|B"||key == "B|C|A"||key == "B|A|C"||key == "C|A|B"||key == "C|B|A") {
            $("input[name=answer]").val(7);
        }
        if (key == "A|B|D"||key == "A|D|B"||key == "B|A|D"||key == "B|D|A"||key == "D|A|B"||key == "D|B|A") {
            $("input[name=answer]").val(11);
        }
        if (key == "A|C|D"||key == "A|D|C"||key == "C|A|D"||key == "C|D|A"||key == "D|A|C"||key == "D|C|A") {
            $("input[name=answer]").val(13);
        }
        if (key == "B|C|D"||key == "B|D|C"||key == "C|B|D"||key == "C|D|B"||key == "D|B|C"||key == "D|C|B") {
            $("input[name=answer]").val(14);
        }
        if (key == "A|B|C|D"||key == "A|B|D|C"||key == "A|C|D|B"||key == "A|C|B|D"||key == "A|D|B|C"||key == "A|D|C|B"||key=="B|A|C|D"
            ||key=="B|A|D|C"||key=="B|C|A|D"||key=="B|C|D|A"||key=="B|D|A|C"||key=="B|D|C|A"||key=="C|A|B|D"||key=="C|A|D|B"
            ||key=="C|B|A|D"||key=="C|B|D|A"||key=="C|D|A|B"||key=="C|D|B|A"||key=="D|A|B|C"||key=="D|A|C|B"||key=="D|B|A|C"||key=="D|B|C|A"
            ||key=="D|C|B|A"||key=="D|C|A|B") {
            $("input[name=answer]").val(15);
        }
        if (key =="是"){
            $("input[name=answer]").val(1);
        }
        if (key =="否"){
            $("input[name=answer]").val(2);
        }
    })
</script>
</body>
</html>
